package com.atguigu.ForeachTest;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

/**
 * @program: IDEAcode
 * @description:
 * @author: Mr.zjx
 * create: 2021-08-01-14-48
 **/
public class TestStudent02 {
    public static void main(String[] args) {
        Set<Student> set = new TreeSet<Student>();
        set.add(new Student("张三",21));
        set.add(new Student("李四",22));//不同对象
        set.add(new Student("李四",22));
        set.add(new Student("王五",28));
        set.add(new Student("赵六",18));
        for (Student s : set){
            System.out.println(s);
        }
    }
}
